package org.kfish.framework.util;

import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
import org.kfish.framework.ConfigConstant;

public class PropsUtil {
	public static Properties loadProps(String PropFileName){
		Properties RsltProp = new Properties();
		try {
			Path normalizePath = Paths.get(PropFileName).normalize();			
			URL configUrl = PropsUtil.class.getClassLoader().getResource(normalizePath.toString());
			if(configUrl!=null){
				RsltProp.load(configUrl.openStream());
			}
		} catch (IOException e) {
		 
			e.printStackTrace();
		}
		return RsltProp;
	}
	
	
	public static String getString(Properties Props,String Key){
		return Props.getProperty(Key);
	}
	
	public static void main(String[] args){
		PropsUtil.loadProps(ConfigConstant.CONFIG_FILE);
	}
}
